/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package m;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Mikael Köhlmyr | mikael@kohlmyr.com | http://www.kmyr.net
 */
public class lang {

    public static int toInt(String in){
        try{
            return Integer.valueOf(in).intValue();
        }
        catch(NumberFormatException ex){
            Logger.getLogger(lang.class.getName()).log(Level.SEVERE, null, ex);
            Integer empty = null;
            return empty.intValue();
        }
    }

    public static int toInt(double in){
        Double d = in;
        return d.intValue();
    }

    public static int toInt(char in){
            if(Character.isDigit(in)){
                String strout = Character.toString(in);
                return Integer.valueOf(strout).intValue();
            }
            Integer empty = null;
        return empty.intValue();
    }

    public static String toStr(int in){
        return Integer.toString(in);
    }

    public static String toStr(char in){
        return Character.toString(in);
    }

    public static String toStr(boolean in){
        return Boolean.toString(in);
    }

    public static String toStr(double in){
        return Double.toString(in);
    }

    public static boolean inverse(boolean in){
        if(in){
            return false;
        }
        return true;
    }

    public static int inverse(int in){
        return in*-1;
    }
}